home *** CD-ROM | disk | FTP | other *** search
- Path: linus.mitre.org!spectre!eachus
- From: eachus@spectre.mitre.org (Robert I. Eachus)
- Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++
- Subject: Re: C/C++ knocks the ....
- Date: 19 Feb 1996 19:32:18 GMT
- Organization: The Mitre Corp., Bedford, MA.
- Message-ID: <EACHUS.96Feb19143218@spectre.mitre.org>
- References: <00001a73+00002504@msn.com> <4etcmm$lpd@nova.dimensional.com>
- <3114d8fb.5a455349@zesi.ruhr.de> <4f5h5t$f13@vixen.cso.uiuc.edu>
- <4g1bgf$l5@mailhub.scitec.com.au> <3124B43F.19E0@escmail.orl.mmc.com>
- <4g2r2r$ded@stc06.ctd.ornl.gov> <dewar.824581148@schonberg>
- <4g6hg8$f4j@ux1.lmu.edu>
- NNTP-Posting-Host: spectre.mitre.org
- In-reply-to: Ray Toal's message of 18 Feb 1996 06:38:00 GMT
-
- In article <4g6hg8$f4j@ux1.lmu.edu> Ray Toal <rtoal@eecs.lmu.edu> writes:
-
- > Norman Cohen just posted a really good article on this topic a few
- > days ago and I won't repeat it here. It should at least "convince"
- > people that separating package and type is a solid design decision
- > and not a hack to maintain upward compatibility with Ada 83.
-
- > Having programmed in Smalltalk and C++ before Ada 95, I admit I had
- > to look twice at the Ada approach because I was so USED TO confusing
- > class with module. But taking a few minutes to get used to Ada's
- > approach I like it better.
-
- There are many people who start out with a "dogmatic" approach to
- ADTs in Ada, limiting them to one per package. But after a while you
- ask why this type and that type appear in the same package
- specification, you get some mumbling about "the $%^*&* language makes
- it too difficult to put them in different packages." A few months
- later you see cogent comments for ADTs in the same package explaining
- why it was done that way, and lots of what I prefer to call "helper"
- type declarations that have no explanation. (And don't need any.)
-
- For example, assume that your (private) ADT has several associated
- flags. You can (and often should) have one inquiry function for each
- flag. But the boolean flags may really indicate that the ADT is in
- one of, say, five states. Best in that case is to define an
- enumeration type in the same package and have a single inquiry
- function, and a single procedure to set the state if that is
- appropriate.
-
- Other cases where "helper" types appear is when there are arrays,
- lists, names, etc. as properties of the main ADT and the ONLY use of
- these types is as state of the primary ADT.
-
- --
-
- Robert I. Eachus
-
- with Standard_Disclaimer;
- use Standard_Disclaimer;
- function Message (Text: in Clever_Ideas) return Better_Ideas is...
-